package com.eastfair.file.api;

import com.eastfair.core.base.R;
import com.eastfair.file.dto.FileDTO;
import com.eastfair.file.vo.FileVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(name = "file/upload")
public interface FileServiceFeign {
    /**
     * 阿里云文件上传
     *
     * @param fileDTO
     * @return
     */
    @PostMapping("/oss-put-file")
    R<FileVO> ossPutFile(@RequestBody FileDTO fileDTO);

    /**
     * 本地文件上传
     *
     * @param file       the file
     * @param bucketName the bucket name
     * @param is   the is mobile
     * @return r r
     * @throws Exception the exception
     */
    @PostMapping(value = "/uploadfile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    R<FileVO> serviceUploadFile(@RequestPart("file") MultipartFile file,
                                @RequestParam("bucketName") String bucketName,
                                @RequestHeader(value = "isMobile", required = false) String isVerify
    );
}
